package webPageContainers4Testing;

import static org.testng.Assert.assertTrue;
import webPageElements4Testing.TextField;
import webPageElements4Testing.TextLabel;
import webPageElements4Testing.TriangleImagePathTag;

public class TriangleTestHomePage extends BasePageContainer {
	public static final String TESTING_TRIANGLES_URL = "http://virtualdevlabs.com/triangle/";
	private TextField triangleSide2TextField;
	private TextField triangleSide1TextField;
	private TextField triangleSide3TextField;
	private TextLabel triangleTypeLabel;
	private TriangleImagePathTag triangleImage;
	
	public TriangleTestHomePage() throws Exception {
		goToPage(TESTING_TRIANGLES_URL);
		verifyTitleIsCorrect("Triangle Tester Exercise");
		triangleSide1TextField = new TextField("triangle_side1");
		triangleSide2TextField = new TextField("triangle_side2");
		triangleSide3TextField = new TextField("triangle_side3");
		triangleTypeLabel = new TextLabel("triangle_type");
		triangleImage = new TriangleImagePathTag();
	}
	
	public boolean canSpecifyTriangle(String firstSideSize, String secondSideSize, String thirdSideSize) {
		assertTrue(triangleSide1TextField().canEnterText(firstSideSize));
		assertTrue(triangleSide2TextField().canEnterText(secondSideSize));
		assertTrue(triangleSide3TextField().canEnterText(thirdSideSize));
		return true;
	}
	
	public boolean triangleTypeLabelReads(String expected) {
		assertTrue(triangleTypeLabel().reads(expected));
		return true;
	}

	
	public TextField triangleSide3TextField() {
		return triangleSide3TextField;
	}

	public TextField triangleSide2TextField() {
		return triangleSide2TextField;
	}

	public TextField triangleSide1TextField() {
		return triangleSide1TextField;
	}

	public TextLabel triangleTypeLabel() {
		return triangleTypeLabel;
	}

	public boolean canVerifyTriangleImageIsDisplayed() {
		return (triangleImage().isDisplayed());
	}

	public TriangleImagePathTag triangleImage() {
		return triangleImage;
	}


	
	
	
}
